package com.weixinli.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.weixinli.beans.Mood;
import com.weixinli.dao.IMoodDao;

@Repository("iMoodDao")
public class MoodDaoImpl implements IMoodDao {
	@Resource(name="sqlSession")
	private SqlSession sqlSession;
	
	public SqlSession getSqlSession() {
		return sqlSession;
	}

	public void setSqlSession(SqlSession sqlSession) {
		this.sqlSession = sqlSession;
	}

	public int addMood(Mood mood) {
		return sqlSession.insert("moodDao.addOneMood",mood);
	}

	public int delMood(Integer mid) {
		return 0;
	}

	public List<Mood> getTotalMood() {
		return sqlSession.selectList("moodDao.moodData");
	}

	public Mood findOneMood(Integer mid) {
		return sqlSession.selectOne("moodDao.oneMoodData", mid);
	}

	public List<Mood> findFriendMood(Integer w_uid) {
		return sqlSession.selectList("moodDao.moodDataByWuid", w_uid);
	}

	public List<Mood> findMoodByTag(String tag) {
		return sqlSession.selectList("moodDao.moodDataByTag", tag);
	}
}
